package com.bookcode.controller;
import com.bookcode.entity.City;
import com.bookcode.service.CityService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
public class CityController {
    @Resource
    private CityService cityService;
    @RequestMapping(value = "/api/city", method = RequestMethod.GET)
    public List<City> findOneCity(@RequestParam(value = "cityName", required = true) String cityName) {
        return cityService.findCityByName(cityName);
    }
}
